#ifndef ____COND_HPP____
#define ____COND_HPP____

#include<iostream>
#include<pthread.h>
#include"mutex.hpp"

class Cond
{
public:
    Cond()
    {
        pthread_cond_init(&_cond,nullptr);
    }

    ~Cond()
    {
        pthread_cond_destroy(&_cond);
    }

    void Wait(Mutex::mutex& _lock)
    {
        pthread_cond_wait(&_cond,&_lock);
    }

    void Broadcast()
    {
        pthread_cond_broadcast(&_cond);
    }

    void Signal()
    {
        pthread_cond_signal(&_cond);
    }


private:
    pthread_cond_t _cond;
};

#endif